#!/bin/bash
# 开始下载
URL=ftp://ftp.vim.org/pub/vim/unix/vim-8.0.tar.bz2
source ../linux/download_unzip.sh "vim8" $URL



#============== 调用本脚本时可用变量 ==============
#>>> $FILE_PATH 文件绝对路径：/opt/software/vim-8.0.tar.bz2
#>>> $FILE_EXTENSION 文件后缀：bz2
#>>> $File_HOME 软件HOME：/opt/module/vim8/vim80
#>>> $REPO_PATH 仓库目录：/opt/repository/vim8

# yum  remove vim*
# yum install epel-release
# yum install -y python36 python36-devel gcc ncurses-devel libzip bzip2 git

# 进入安装目录
cd $File_HOME
# 编译
make clean
./configure \
--prefix=/opt/module/vim8 \
--enable-fail-if-missing \
--enable-python3interp \
--enable-multibyte \
--enable-fontset \
--with-features=huge
# 编译
make
make install



# 未设置过，则配置VIM环境变量
if (( 0 == `cat /etc/profile | grep VIM_HOME | wc -l` )); then
sudo cat >>/etc/profile<<EOF

#====  配置 VIM 环境变量  =======
VIM_HOME=/opt/module/vim8
PATH=\$PATH:\$VIM_HOME/bin
export VIM_HOME PATH
EOF
fi

source /etc/profile

# 查看vim的python 依赖
echo "============VIM8 PYTHON依赖=============="
vim --version | grep python
# 安装spacevim
# curl -sLf https://spacevim.org/cn/install.sh | bash
# SpaceVim 的默认配置文件为 vim ~/.SpaceVim.d/init.toml
# Docker 支持
# docker pull spacevim/spacevim
# docker run -it --rm spacevim/spacevim nvim